import unittest
from JK_UI.utlis.HTMLTestRunner3_New import HTMLTestRunner
from JK_UI.utlis.mail3 import SendMail
def run():
    path=r'D:\pythonProject2\JK_UI\testcase'
    report_path=r'D:\pythonProject2\JK_UI\report'
    dicover=unittest.defaultTestLoader.discover(start_dir=path,pattern="Test_*.py")
    filename=report_path+'\\'+'CMS_API_report.html'
    f=open(file=filename,mode='wb')
    runner=HTMLTestRunner(
        stream=f,
        title='CMS平台测试用例执行情况',
        description="接口测试用例执行情况",
        tester='迪迦'
    )
    runner.run(dicover)
    f.close()
    sendmail=SendMail(send_msg=filename,attachment=filename)
    sendmail.send_mail()
run()